]> git.neil.brown.name Git - wiggle.git/log
wiggle.git
6 years agoRelease v1.1 v1.1
NeilBrown [Thu, 28 Sep 2017 12:37:04 +0000 (22:37 +1000)]
Release v1.1

No substantial changes, just 4 years of tiny bits and pieces.

Fixed #9

Signed-off-by: NeilBrown <neil@brown.name>
6 years agohash.c: add /* fallthrough markers */
NeilBrown [Thu, 28 Sep 2017 12:29:12 +0000 (22:29 +1000)]
hash.c: add /* fallthrough markers */

Recent gcc warns about case fall-through, so tell it not to.

Signed-off-by: NeilBrown <neil@brown.name>
6 years agovpatch: fix build warning
NeilBrown [Thu, 28 Sep 2017 12:25:15 +0000 (22:25 +1000)]
vpatch: fix build warning

This condition was a bit convoluted and while it was correct,
it doesn't look it.

Move the '!' into the '==' so the intention is a bit clearer
and compiler doesn't complain.

Fixes #7

Signed-off-by: NeilBrown <neil@brown.name>
10 years agoMerge branch 'allow-prefix-on-make' of https://github.com/ankon/wiggle
NeilBrown [Tue, 13 May 2014 23:32:08 +0000 (09:32 +1000)]
Merge branch 'allow-prefix-on-make' of https://github.com/ankon/wiggle

10 years agoUse install(1) -d explicitly, avoiding the need for -D
Andreas Kohn [Tue, 13 May 2014 23:06:36 +0000 (01:06 +0200)]
Use install(1) -d explicitly, avoiding the need for -D

-D isn't available on MacOS X by default, but there is not much point
here in using it: we can just create the directories first.

10 years agoAdd a PREFIX variable so one can easily install wiggle into a different tree
Andreas Kohn [Tue, 13 May 2014 23:08:55 +0000 (01:08 +0200)]
Add a PREFIX variable so one can easily install wiggle into a different tree

Main use-case here: make install PREFIX=$HOME, to have it install into the user's
$HOME directory.

10 years agoman: Correct preceeding to preceding
Jari Aalto [Tue, 8 Apr 2014 06:23:56 +0000 (09:23 +0300)]
man: Correct preceeding to preceding

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoFix endian checks as per austin group definitions of endian.h
Dimitri John Ledkov [Mon, 6 Jan 2014 03:57:03 +0000 (03:57 +0000)]
Fix endian checks as per austin group definitions of endian.h

Debian-Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733831
Reference: http://www.opengroup.org/austin/docs/austin_514.txt

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMakefile: make it easy to suppress the "-D" flag to "install".
NeilBrown [Wed, 16 Oct 2013 01:58:51 +0000 (12:58 +1100)]
Makefile: make it easy to suppress the "-D" flag to "install".

Some versions of "install" do not support '-D', and it isn't needed
when installing to default location.
So all
  make INSTALL=install
to suppress the -D

Reported-by: Christian Sonne
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMakefile: make it easy to change warning flags.
NeilBrown [Wed, 16 Oct 2013 01:54:26 +0000 (12:54 +1100)]
Makefile: make it easy to change warning flags.

Some people need to get rid of "-Werror".
Make that easier wit
  make CWFLAGS=

Reported-by: Christian Sonne
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMerge branch 'master' of https://github.com/seanfarley/wiggle
NeilBrown [Wed, 9 Oct 2013 00:19:01 +0000 (11:19 +1100)]
Merge branch 'master' of https://github.com/seanfarley/wiggle

10 years agomakefile: add -Wno-missing-field-initializers since {0} is valid C99
Sean Farley [Sun, 6 Oct 2013 00:46:33 +0000 (08:46 +0800)]
makefile: add -Wno-missing-field-initializers since {0} is valid C99

10 years agovpatch: change prepare_merge to a macro for proper c
Sean Farley [Tue, 8 Oct 2013 23:23:45 +0000 (07:23 +0800)]
vpatch: change prepare_merge to a macro for proper c

10 years agovpatch: change find_line to a macro for proper c
Sean Farley [Tue, 8 Oct 2013 23:23:11 +0000 (07:23 +0800)]
vpatch: change find_line to a macro for proper c

10 years agovpatch: change free_stuff to a macro for proper c
Sean Farley [Tue, 8 Oct 2013 14:36:35 +0000 (22:36 +0800)]
vpatch: change free_stuff to a macro for proper c

10 years agovpatch: avoid warning from gcc-4.4.6
NeilBrown [Tue, 27 Aug 2013 23:38:33 +0000 (09:38 +1000)]
vpatch: avoid warning from gcc-4.4.6

It seems that gcc-4.4.6 doesn't like

   struct plist p = {0};

as it don't initialise all fields.
I only added that to make sure 'outfile' was initialised, so
just do that explicitly.

Reported-by: Stephen Cameron @ G+
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMakefile: suppress error messages from 'git'.
NeilBrown [Tue, 27 Aug 2013 23:35:14 +0000 (09:35 +1000)]
Makefile: suppress error messages from 'git'.

If you have a clone of the 'wiggle' git tree but with no
tags, then "git describe HEAD" will complain
   fatal: No names found, cannot describe anything.
As it produces no output, the compiled in default will be used
so this is just an unnecessary message.  So send it to /dev/null.

Reported-by: Stephen Cameron @ G+
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoRelease wiggle v1.0 v1.0
NeilBrown [Fri, 23 Aug 2013 06:02:27 +0000 (16:02 +1000)]
Release wiggle v1.0

Hurray!

10 years agoAdd 'dovtest'.
NeilBrown [Fri, 23 Aug 2013 06:01:27 +0000 (16:01 +1000)]
Add 'dovtest'.

This runs 'browser' mode under valgrind to look for errors.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: avoid unused-variable error from valgrind.
NeilBrown [Fri, 23 Aug 2013 05:59:37 +0000 (15:59 +1000)]
Browser: avoid unused-variable error from valgrind.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: refine 'c' and 'x' commands.
NeilBrown [Fri, 23 Aug 2013 05:32:19 +0000 (15:32 +1000)]
Browser: refine 'c' and 'x' commands.

'x' will try to make text go away.
'c' will try to make text stay.
'X' will undo all such changes on the current line.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: remove some more infinite loops.
NeilBrown [Fri, 23 Aug 2013 05:29:55 +0000 (15:29 +1000)]
Browser: remove some more infinite loops.

More places where we can get confused and then spin forever.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMan page updates.
NeilBrown [Fri, 23 Aug 2013 04:59:34 +0000 (14:59 +1000)]
Man page updates.

Lots of clean ups, fixes, additions etc

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoHack to improve view of ignore-blank conflicts.
NeilBrown [Fri, 23 Aug 2013 04:24:14 +0000 (14:24 +1000)]
Hack to improve view of ignore-blank conflicts.

  cd tests/contrib/abstract
  ../../../wiggle -Bb orig new new2
select the "central" and type 'x' so it disappears and note
that the only remaining difference is that "computational"
has been deleted.
Without this patch you only see one '-' line and no '+' line.

However the result isn't perfect as
   ./wiggle -Bp demo.patch
 visit the README file
 page down to waht "You can use 'o'  ..." as added.
And note that there is a '-' blank line and a '+' blank line.
These are unwanted and added by this patch.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: avoid possible infinite loop.
NeilBrown [Fri, 23 Aug 2013 03:10:12 +0000 (13:10 +1000)]
Browser: avoid possible infinite loop.

This can sometimes loop indefintely, so check for 'End' and
drop out.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: discard VTRACE code.
NeilBrown [Fri, 23 Aug 2013 01:35:15 +0000 (11:35 +1000)]
Browser: discard VTRACE code.

It doesn't really work any more and isn't really needed.
The status line at the top provides enough info.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: disable ignore-blanks after editing.
NeilBrown [Fri, 23 Aug 2013 01:20:54 +0000 (11:20 +1000)]
Browser: disable ignore-blanks after editing.

If we leave it enabled, then the result written out can
be different to the final edit and print_merge prefers the
A stream to the C stream.

Disabling it shouldn't hurt as now more cleverness is expected,
just viewing of the result.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: base tempfile name on that of original file.
NeilBrown [Fri, 23 Aug 2013 00:37:05 +0000 (10:37 +1000)]
Browser: base tempfile name on that of original file.

This way editor file-type detection (e.g. *.c means C file) works,
and as it is in the same directory, other related files are
easily found.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: delete temporary file after reading it back in.
NeilBrown [Fri, 23 Aug 2013 00:28:15 +0000 (10:28 +1000)]
Browser: delete temporary file after reading it back in.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoUpdate copyright claims.
NeilBrown [Thu, 22 Aug 2013 08:30:33 +0000 (18:30 +1000)]
Update copyright claims.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoman page: mention lack of Unicode support
NeilBrown [Thu, 22 Aug 2013 08:24:14 +0000 (18:24 +1000)]
man page: mention lack of Unicode support

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoman page: update instructions for git usage.
NeilBrown [Thu, 22 Aug 2013 08:21:43 +0000 (18:21 +1000)]
man page: update instructions for git usage.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoman page: Quote some more hyphen.
NeilBrown [Thu, 22 Aug 2013 08:05:29 +0000 (18:05 +1000)]
man page: Quote some more hyphen.

When we have a literal hyphen, we need to quote it.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAdd --output option to redirect output.
NeilBrown [Thu, 22 Aug 2013 07:54:42 +0000 (17:54 +1000)]
Add --output option to redirect output.

This is particularly useful for "git mergetool"

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: if editing leaves no conflicts, display diff.
NeilBrown [Thu, 22 Aug 2013 03:44:47 +0000 (13:44 +1000)]
Browser: if editing leaves no conflicts, display diff.

This isn't completely consistent behaviour, but it seems useful
for now.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: pass line number to editor when editting the merge.
NeilBrown [Thu, 22 Aug 2013 03:00:58 +0000 (13:00 +1000)]
Browser: pass line number to editor when editting the merge.

We calculate which line in the file the cursor is on and
pass that to the editor with "+N".

The calculation doesn't seem quite right sometimes, but
it is close.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: edit merge in a temporary file.
NeilBrown [Thu, 22 Aug 2013 03:24:40 +0000 (13:24 +1000)]
Browser: edit merge in a temporary file.

When editing a merge, do so in a temp file so it is still
easy to revert to the original.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser -- support page-up and page-down
NeilBrown [Wed, 21 Aug 2013 07:26:10 +0000 (17:26 +1000)]
Browser -- support page-up and page-down

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAllow diffs to be browsed.
NeilBrown [Wed, 21 Aug 2013 07:20:51 +0000 (17:20 +1000)]
Allow diffs to be browsed.

If --diff is given with --browse, then the diff can
be explored with colourful highlighting.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: add 'v' to open file in an editor.
NeilBrown [Wed, 21 Aug 2013 05:24:41 +0000 (15:24 +1000)]
Browser: add 'v' to open file in an editor.

'v' as in 'visual', just like 'less'.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoRemove stray file.
NeilBrown [Wed, 21 Aug 2013 02:38:40 +0000 (12:38 +1000)]
Remove stray file.

Don't know where this came from...

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agomanpage: add notes about how to integrate with git.
NeilBrown [Wed, 21 Aug 2013 02:34:33 +0000 (12:34 +1000)]
manpage: add notes about how to integrate with git.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAdd --report-wiggles option
NeilBrown [Wed, 21 Aug 2013 02:17:34 +0000 (12:17 +1000)]
Add --report-wiggles option

This results in 'failure' status if any wiggles were required.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: update all of status line in one place.
NeilBrown [Wed, 21 Aug 2013 01:46:48 +0000 (11:46 +1000)]
Browser: update all of status line in one place.

This removes the need to erase some number of spaces before
the right-justified bit, which was sometimes erasing too much.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoPreserve per-hunk "comment" field.
NeilBrown [Wed, 21 Aug 2013 01:40:59 +0000 (11:40 +1000)]
Preserve per-hunk "comment" field.

Each diff/patch hunk can have a comment, often a function
name extract with "diff -p".
Preserver that comment and display it when we print hunk headers,
particularly in the browser.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agovpatch: simplify display of editted mergers.
NeilBrown [Wed, 21 Aug 2013 00:19:30 +0000 (10:19 +1000)]
vpatch: simplify display of editted mergers.

Rather than having some special cases, simply use the original 'type'
unless RESULT is requested.  In that case use the new 'type'.

This is much more general and seems to work OK.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: add 'c' command to accept a conflict.
NeilBrown [Tue, 20 Aug 2013 23:35:01 +0000 (09:35 +1000)]
Browser: add 'c' command to accept a conflict.

'c' will change a 'Conflict' to 'Changed' so we keep the result
even though the 'before' part doesn't match.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMake some fatal errors more helpful.
NeilBrown [Tue, 20 Aug 2013 05:29:53 +0000 (15:29 +1000)]
Make some fatal errors more helpful.

Complain sensibly if something is a directory, and
mention that read or malloc failed if it did.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowse: make sure 'X' doesn't loop forever searching backwards.
NeilBrown [Tue, 20 Aug 2013 05:12:42 +0000 (15:12 +1000)]
Browse: make sure 'X' doesn't loop forever searching backwards.

it did once..

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAllow interactive setting of "--ignore-blanks" flag.
NeilBrown [Tue, 20 Aug 2013 05:04:56 +0000 (15:04 +1000)]
Allow interactive setting of "--ignore-blanks" flag.

"I" will toggle whether blanks are significant or not
in matching text.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowse: suppress "last-key" debugging.
NeilBrown [Tue, 20 Aug 2013 01:19:42 +0000 (11:19 +1000)]
Browse: suppress "last-key" debugging.

Only display this if a suitable DEBUG envionment variable is set.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowse: allow "--replace" to be requested while viewing.
NeilBrown [Tue, 20 Aug 2013 01:10:54 +0000 (11:10 +1000)]
Browse: allow "--replace" to be requested while viewing.

If you type 'S' then on exit the file you are looking at
will be saved.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: highlight spaces at the end of a line.
NeilBrown [Tue, 20 Aug 2013 00:42:23 +0000 (10:42 +1000)]
Browser: highlight spaces at the end of a line.

Otherwise they are invisible.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAdd some test after the markers in a merge.
NeilBrown [Mon, 19 Aug 2013 23:55:23 +0000 (09:55 +1000)]
Add some test after the markers in a merge.

"git rerere" likes to see a space after the "<<<<<<<" and
">>>>>>>".  So put it there and add a vaguely relevant word too.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agomerge: fix another bug in isolate_conflicts.
NeilBrown [Mon, 19 Aug 2013 07:44:16 +0000 (17:44 +1000)]
merge: fix another bug in isolate_conflicts.

In unusual cases we can fall off the end - better check.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agovpatch: discard 'ignored' for 'oldtype'.
NeilBrown [Mon, 19 Aug 2013 06:24:18 +0000 (16:24 +1000)]
vpatch: discard 'ignored' for 'oldtype'.

Rather than 'ignore'ing certain merges, we allow the type
of each merger to be modified.  This feels more flexible and
should be easier to understand.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agomerge: fix reporting of empty "conflicts".
NeilBrown [Mon, 19 Aug 2013 05:03:37 +0000 (15:03 +1000)]
merge: fix reporting of empty "conflicts".

The important part of this patch is the end in print_merge().
If one conflict follows another with nothing in between,
then we really should try to mark up that 'nothingness' as
a resolved conflict.

The other parts as just cleaning up isolate_conflicts a bit more
as I tried to figure out what was happening.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agotests: new test case for stray &&&&&
NeilBrown [Mon, 19 Aug 2013 05:00:50 +0000 (15:00 +1000)]
tests: new test case for stray &&&&&

We sometime get stray empty conflicts, particularly with &&&&&&
even though show-wiggles wasn't requested.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: Don't highlight spaces so much.
NeilBrown [Mon, 19 Aug 2013 01:15:53 +0000 (11:15 +1000)]
Browser: Don't highlight spaces so much.

Highlighting spaces is very noisy and doesn't help very much.
We only really need to differentiate spaces from tabs and highlighting
tabs is enough for that.

We continue to highlight spaces that are adjacent to tabs, but not
other spaces.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoUnwrap some printf string.
NeilBrown [Mon, 19 Aug 2013 01:00:11 +0000 (11:00 +1000)]
Unwrap some printf string.

Have long lines is much better than having to break strings in odd places.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser help: add some missing commas.
NeilBrown [Mon, 19 Aug 2013 00:59:29 +0000 (10:59 +1000)]
Browser help: add some missing commas.

The missing commas would just to lines into one.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoExtract version information from 'git' if possible.
NeilBrown [Thu, 28 Mar 2013 01:53:57 +0000 (12:53 +1100)]
Extract version information from 'git' if possible.

The version number (and date) reported by "wiggle -V" now
includes information from 'git' if the code was build from a
git repo rather than from a tar-ball.

Suggested-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: be more careful about aligning hunk-headers with newlines.
NeilBrown [Fri, 22 Mar 2013 04:12:49 +0000 (15:12 +1100)]
merge: be more careful about aligning hunk-headers with newlines.

When matching a diff to a file, it would be very confusing.
if the last match from one hunk were on the same line of the
original as the first match of the next hunk.
So we try to align hunk-headers with newlines.

In particular, we often find Unmatched and Extraneous
sections together.  There can be encoded in any order.
If the Extraneous section contains a hunk-header,
we want to make sure that if there is a newline anywhere
in the unmatched section, then the Unmatched that is placed
before the hunk-headers Extraneous ends on a newline.

There was code the attempted this, but it was too simplistic
and would sometimes move outside the regions that it should
have been examine, which would lead to various bugs.

The tests case which demonstrated this is added to the
test suite.

Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agocsl_join should merge adjacent matches.
NeilBrown [Fri, 22 Mar 2013 04:04:48 +0000 (15:04 +1100)]
csl_join should merge adjacent matches.

When diffing against a patch we treat each hunk separately
and join the result.
This joining doesn't merge adjacent matches so it doesn't really
tell the full story of where the matches are and how big
they are.  This can confuse other code, particularly when
examining hunk headers to create the merger.

So add detection for adjacent matches.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: calculate number of wiggles more accurately.
NeilBrown [Thu, 7 Mar 2013 03:09:46 +0000 (14:09 +1100)]
merge: calculate number of wiggles more accurately.

Assess wiggles the same way that we assess conflict,
and then count the number of each.
This gives more meaningful counts.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: tidy up isolation of conflicts.
NeilBrown [Thu, 7 Mar 2013 02:10:02 +0000 (13:10 +1100)]
merge: tidy up isolation of conflicts.

We want to isolate (and these count) wiggles much
like we do conflicts, but the conflict isolating
code is just confusing.

So try to make it a bit cleaner, and defined clearly
the various states.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: restore display for hunk header where appropriate.
NeilBrown [Tue, 5 Mar 2013 04:36:50 +0000 (15:36 +1100)]
vpatch: restore display for  hunk header where appropriate.

Recent patch broke this.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoAdd --ignore-blanks option.
NeilBrown [Tue, 5 Mar 2013 04:00:17 +0000 (15:00 +1100)]
Add --ignore-blanks option.

This can be useful when people re-flow you text or otherwise
introduce space-damange that just really isn't interesting.

Suggested-by: Tom Scogland <tom.scogland@vt.edu>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow a word to have text before the newline.
NeilBrown [Fri, 1 Mar 2013 08:09:35 +0000 (19:09 +1100)]
vpatch: allow a word to have text before the newline.

Previously we don't print out ends_line() words at all.
But soon a word might have some content plus a newline at
the end.
So restructure the display to print non-newline characters
from any word.
Note that we cannot have characters *after* a newline.
Doing that would break too much of wiggle's formating
assumptions.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoAllow a word to have an unmatched prefix and suffix.
NeilBrown [Fri, 1 Mar 2013 08:05:27 +0000 (19:05 +1100)]
Allow a word to have an unmatched prefix and suffix.

i.e. The part of a word that is tested for matching is
shorted than the whole word that is printed.  There can
be a prefix and a suffix.  In a future patch, an option
will be availble to include most spaces as prefix or suffix
of nearby non-space.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agodiscard ends_mline, just use ends_line
NeilBrown [Fri, 1 Mar 2013 07:56:34 +0000 (18:56 +1100)]
discard ends_mline, just use ends_line

There is no important difference between ends_mline and ends_line (any
more), so just discard the former.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: restructure draw_mside.
NeilBrown [Fri, 1 Mar 2013 07:46:00 +0000 (18:46 +1100)]
vpatch: restructure draw_mside.

We have the end-of-line handing code in the middle of
a 'while', and the only return from the function is at
the end of the eol handling.  And there is nothing after the "while".

So move the eol handling code out of the while, and just put
a "break" in place of it.

No functionality change.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoRemove duplicate definition of "csl_join"
NeilBrown [Fri, 1 Mar 2013 05:52:10 +0000 (16:52 +1100)]
Remove duplicate definition of "csl_join"

We really only need one of these.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: Remove noise from --show-wiggles output.
NeilBrown [Fri, 1 Mar 2013 05:02:15 +0000 (16:02 +1100)]
merge: Remove noise from --show-wiggles output.

When --show-wiggles is used with whole files (current, orig, new) and
extraneous text in orig/new (Which isn't a change, so should be
ignored) is treated as a wiggle and causes a conflict to be shown.
Obviously not good.

So insist that any show-wiggle conflict contains at leas a Changed or
a Conflict.  Also allow Changed and Unmatched to be 'near' each other,
not only on the same line, to signal a wiggle.  Current 'near' measure
is 3 lines.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: fix browse of three-file merge.
NeilBrown [Wed, 20 Feb 2013 04:19:42 +0000 (15:19 +1100)]
vpatch: fix browse of three-file merge.

Due to a flag problem, it was ignoring the second and third files.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agotests: add 'merge' test for linux/raid5
NeilBrown [Tue, 19 Feb 2013 05:20:43 +0000 (16:20 +1100)]
tests: add 'merge' test for linux/raid5

We had the orig and the patch, but no actual tests here.
Strange.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoAdd valgrind testing of parts of vpatch.
NeilBrown [Thu, 14 Feb 2013 06:31:18 +0000 (17:31 +1100)]
Add valgrind testing of parts of vpatch.

With --self-test, browsing a simple merge will simply
display at every line.
"make vtest" will run this for every merge in the test suite
and use valgrind to look for problems.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoAdd "make valgrind"
NeilBrown [Thu, 14 Feb 2013 05:53:42 +0000 (16:53 +1100)]
Add "make valgrind"

This runs the test suite under valgrind and complains if any
errors are detected.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: remove some meaningless AlreadyApplied
NeilBrown [Thu, 14 Feb 2013 05:40:50 +0000 (16:40 +1100)]
merge: remove some meaningless AlreadyApplied

Finding an AlreadyApplied amid Conflicts and Extraneous etc is
unlikely to be helpful.  So don't do it.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agobestmatch: improve poor matches.
NeilBrown [Thu, 14 Feb 2013 05:30:29 +0000 (16:30 +1100)]
bestmatch: improve poor matches.

If the bestmatch doens't include all of the lines in a hunk, try to
find matches between the unmatch parts of the hunk, and surrounding
text in the original.

This is particularly useful when some of the context is just blank
lines.  The best-match algorithm might ignore blank lines because they
aren't big enough to justify much distance from the rest of the match.

This makes tests/linux/raid1-A/merge a lot nicer.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: remove useless context from the end of a conflict.
NeilBrown [Wed, 13 Feb 2013 23:45:57 +0000 (10:45 +1100)]
merge: remove useless context from the end of a conflict.

If we are close to the end-of-file, then don't expect
too many unchanged lines.
And allow zero lines of context in the merge if  it is unchanged out
side the merge.

Update various tests to match - all clear improvements.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agomerge: remove useless context at the start of a conflict.
NeilBrown [Wed, 13 Feb 2013 23:22:18 +0000 (10:22 +1100)]
merge: remove useless context at the start of a conflict.

There are two fixes here.

The first allows the newline at the end of an unchanged region to be
the 'first' newline found so that if there are several others to
provide backup, it will be used.

The second allows the start-of-file to be strong enough context to
not require three full lines of explicit context.

Then we change a lot of the self-tests to match.  In each case the
result is a clear improvement.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: fix another access-beyond-array
NeilBrown [Wed, 13 Feb 2013 06:28:30 +0000 (17:28 +1100)]
vpatch: fix another access-beyond-array

This was found by valgrind as well: prev_melmnt needs to check
'type' just like next_melmnt does.

This  revealed an infinite loop because we have a 'hi' value that
was wrong but being trusted.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow relevant signals to cause a core-dump.
NeilBrown [Tue, 12 Feb 2013 04:00:38 +0000 (15:00 +1100)]
vpatch: allow relevant signals to cause a core-dump.

We catch SIGBUS and SIGSEGV so the terminal can be reset.
But that means we don't see a core dump if there should be one.

So for those signals, clear the signal handler after reseting
the terminal, and return.  Then the core will be dumped.

Reported-by: Paul Wise <pabs3@bonedaddy.net>
11 years agovpatch: fix various reference errors found by valgrind.
NeilBrown [Tue, 12 Feb 2013 03:47:51 +0000 (14:47 +1100)]
vpatch: fix various reference errors found by valgrind.

We sometimes fall of the end, or the start, of various arrays,
or use variables we haven't initialised.

Reported-by: Paul Wise <pabs3@bonedaddy.net>
Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoBrowser: add missing documentation for Save and Restore in main window
NeilBrown [Thu, 7 Feb 2013 00:07:05 +0000 (11:07 +1100)]
Browser: add missing documentation for Save and Restore in main window

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agodiff: make rediffing of patches more precise.
NeilBrown [Wed, 6 Feb 2013 23:38:15 +0000 (10:38 +1100)]
diff: make rediffing of patches more precise.

When wiggle is given a patch, it splits it into a 'before' and an
'after' section and creates a diff between those.
The hunks in the patch are separated by headers and it is assumed that
these headers will line up in the result.

However: if one hunk removes a chunk of test and  another hunk adds
that chunk of text, the chunk may appear more significant than the
hunk headers, so it will line up, and the hunk headers won't
This creates a mess as one of the current tests shows, and as a
newly added test demonstrates quite neatly.

So if we are re-diffing a patch, find the hunk headers and only
diff the bits between them.

This allows the new test to work, and improves the result of the old
test.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoDOC: remove diff.ps due to distribution license issues.
NeilBrown [Mon, 4 Feb 2013 22:57:56 +0000 (09:57 +1100)]
DOC: remove diff.ps due to distribution license issues.

Replace with DOC/Algorithm which refers to the original document
and explains some of the differences.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add mouse movement to merge_window.
NeilBrown [Thu, 15 Nov 2012 05:39:02 +0000 (16:39 +1100)]
vpatch: add mouse movement to merge_window.

If you click in the 'other' pane, just jump to that pane.
If you click in the same pane, go to the character.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add mouse support for main window.
NeilBrown [Thu, 15 Nov 2012 05:09:13 +0000 (16:09 +1100)]
vpatch: add mouse support for main window.

Clicking on a line will cause that file or folder to be
opened.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agoMan page updates.
NeilBrown [Thu, 15 Nov 2012 04:59:59 +0000 (15:59 +1100)]
Man page updates.

Various typo, recent changes, and more info about Browsing.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow control-C to disable --replace function.
NeilBrown [Thu, 15 Nov 2012 04:18:21 +0000 (15:18 +1100)]
vpatch: allow control-C to disable --replace function.

This requires 'raw' mode instead of just 'cbreak'.  I guess it is time.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: handle --replace option.
NeilBrown [Thu, 15 Nov 2012 04:13:28 +0000 (15:13 +1100)]
vpatch: handle --replace option.

If --replace if given, then we save without prompting.
Without --replace we only prompt of something has been changed or
saved manually.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add X command to ignore all changes in the line.
NeilBrown [Thu, 15 Nov 2012 03:07:09 +0000 (14:07 +1100)]
vpatch: add X command to ignore all changes in the line.

'X' will toggle the ignoring of all Conflict and Changeds in
the current line.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: make sure render is stable when the merge is changed.
NeilBrown [Thu, 15 Nov 2012 02:46:33 +0000 (13:46 +1100)]
vpatch: make sure render is stable when the merge is changed.

If we are in the main window and pos suddenly is not 'visible',
we need to jump to the new, visible, pos.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow changes to be ignored as well as conflict.
NeilBrown [Thu, 15 Nov 2012 02:45:51 +0000 (13:45 +1100)]
vpatch: allow changes to be ignored as well as conflict.

Because sometimes a 'change' that is found is really a conflict.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: fix display for ignored conflicts.
NeilBrown [Thu, 15 Nov 2012 01:23:59 +0000 (12:23 +1100)]
vpatch: fix display for ignored conflicts.

We need to make sure we display the 'before' bit, not just
hide the 'after' bit.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: add "control-X-O" as a watch to change panes.
NeilBrown [Thu, 15 Nov 2012 00:10:23 +0000 (11:10 +1100)]
vpatch: add "control-X-O" as a watch to change panes.

My emacs-fingers want to do that, so let them.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: allow mode setting keys to toggle back to 'merge'.
NeilBrown [Wed, 14 Nov 2012 23:59:04 +0000 (10:59 +1100)]
vpatch: allow mode setting keys to toggle back to 'merge'.

When I set the mode to anything other than 'merge', I usually want to
then go straight back to 'merge'.  And if someone does it by mistake,
a toggle function is easier to guess.

So make all mode setting commands toggle between their mode, and
'merge'.

Signed-off-by: NeilBrown <neilb@suse.de>
11 years agovpatch: change appearance of ignored conflicts.
NeilBrown [Wed, 14 Nov 2012 23:43:26 +0000 (10:43 +1100)]
vpatch: change appearance of ignored conflicts.

I'm not sure about this yet, but ignored conflicts should look
a bit different to normal ones, so remove some of the highlight.

Signed-off-by: NeilBrown <neilb@suse.de>